package com.hontech.pastacooking.net

import com.hontech.pastacooking.app.parseJson

class ReadFrame (val req: Int, val body: ByteArray?) {

    fun isNotify() = (req and NOTIFY_FLAG) != 0

    fun request() = (req and ((NOTIFY_FLAG + SALVE_FLAG).inv()))

    inline fun <reified T> parseJson(): T {
        return body!!.parseJson()
    }

    fun isPoll() = request() == REQ_POLL
}



